<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%@ taglib prefix="his_fns" uri="/WEB-INF/tlds/his_fns.tld" %>
<script type="text/javascript">
  $(function (){
      $("#bedsideCardPrint").on("click",function () {
          var array = '';
          var selectedData = $("input[id=patVisitIds]:checked");
          if (selectedData.length <= 0) {
              toastr.info("请选择要打印的病人数据");
              return;
          }
          selectedData.each(function () {
              array = array + $(this).val() + ",";
          });
          array = array.substring(0, array.length - 1);
          printPdf('${ctx}/doctor/patVisit/bedsideCardPrint', 'ids=' + array);
      });
      $("#normalPrint").on("click",function () {
          var array = '';
          var selectedData = $("input[id='patVisitIds']:checked");
          if (selectedData.length <= 0) {
              toastr.info("请选择要打印的病人数据");
              return;
          }else if(selectedData.length > 1){
              toastr.info("只能选择一条病人数据");
              return;
          }
          selectedData.each(function () {
              array = array + $(this).val() + ",";
          });
          array = array.substring(0, array.length - 1);
          printPdf('${ctx}/doctor/patVisit/normalPrint', 'id=' + array);
      });

  });

</script>
<div class="app">
  <section class="layout">
    <section class="main-content col-lg-12" id="LeftDiv">
      <div class="content-wrap">
        <div class="wrapper" style="bottom: 50px;">
          <ul class="nav nav-tabs">
            <li class="active">
            <a href="#" onclick="loadDiv('nurseIndexDiv','${ctx}/nurse/index')">床位列表</a>
            </li>
          </ul>
          <section class="panel panel-default">
            <div class="panel-body">
              <div class="form-group">
                <form:form id="searchFormDict" modelAttribute="patVisit" onsubmit="return loadDivForm('mainCenterDiv','searchFormDict','${ctx}/doctor/patVisit/bedCardList');" method="post" class="form-inline">
                  <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                  <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                  <label>住院号：</label><form:input path="visitNo" htmlEscape="false" maxlength="50" class="form-control" />
                  &nbsp;<label>床号 ：</label><form:input path="bedNo" htmlEscape="false" maxlength="50" class="form-control" />
                  &nbsp;<label>姓名：</label><form:input path="patVisitIndex.name" htmlEscape="false" maxlength="50" class="form-control" />
                  &nbsp;<label>性别：</label>
                  <form:select path="patVisitIndex.sex" cssClass="form-control">
                    <form:option value="">全部</form:option>
                    <form:options itemLabel="label" items="${fns:getDictList('SEX_DICT')}" itemValue="value"></form:options>
                  </form:select>
                  &nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                  &nbsp;<input id="normalPrint"  class="btn btn-primary" type="button" value="普通卡打印"/>
                  &nbsp;<input id="bedsideCardPrint"  class="btn btn-primary" type="button" value="病历卡片打印"/>
                <%--  &nbsp;<input id="print"  class="btn btn-primary" type="button" value="病历打印"/>--%>
                </form:form>
              </div>
              <div class="table-responsive no-border">

                <table id="contentTable"  checkbox="true" class="table table-bordered table-striped mg-t datatable">
                  <thead>
                  <tr>
                    <th><input type="checkbox" id="all" ></th>
                    <th>住院号</th>
                    <th>住院天数</th>
                    <th>床号</th>
                    <th>姓名</th>
                    <th>男/女</th>
                    <th>年龄</th>
                    <th>入院时间</th>
                    <th>护理等级</th>
                    <th>诊断</th>
                    <th>主治医生</th>
                    <th>责任护士</th>
                    <th>入科时间</th>
                    <th>所在科室</th>
                    <th>入病区时间</th>
                    <th>所在病区</th>
                  </tr>
                  </thead>
                  <tbody>
                  <c:forEach items="${page.list}" var="pv">
                    <tr>
                      <td><input type="checkbox" value="${pv.id}" id="patVisitIds"></td>
                      <td> ${pv.visitNo}</td>
                      <td> ${pv.days}</td>
                      <td> ${pv.bedNo}</td>
                      <td> ${pv.patVisitIndex.name}</td>
                      <td> ${fns:getDictLabel(pv.patVisitIndex.sex,"SEX_DICT" ,"通用" )}</td>
                      <td> ${pv.patVisitIndex.age}</td>
                      <td> <fmt:formatDate value="${pv.admissionDate}" pattern="yyyy-MM-dd" /></td>

                      <td> ${fns:getDictLabel(pv.nursingClass,"NURSING_CLASS_DICT" ,"" )}</td>
                      <td> ${pv.diagnosis}</td>
                      <td> ${fns:getUserName(pv.doctorInCharge)}</td>
                      <td> ${fns:getUserName(pv.dutyNurse)}</td>
                      <td> <fmt:formatDate value="${pv.enterDeptDate}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
                      <td> ${fns:getDeptName(pv.deptStayed, '')}</td>
                      <td> <fmt:formatDate value="${pv.enterDeptDate}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
                      <td> ${fns:getDeptName(pv.wardCode, '')}</td>

                    </tr>
                  </c:forEach>
                  </tbody>
                </table>
                <div class="pagination">${page}</div>
              </div>
            </div>
          </section>
        </div>
      </div>
    </section>
  </section>
</div>
